package com.Mapper;

import com.Entity.Order;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;

public interface OrderMapper {
    @Select("select * from user")
    List<Order> all();

    @Select("select * from user where id = #{id} ")
    Order byId();

    @Select("select * from user where customer = #{customer} ")
    List<Order> byCustomer();

    @Select("select * from user where paymentMethods = #{paymentMethods} ")
    List<Order> byPaymentMethods();

    @Insert("insert into user(id, name, password, phone, sex, isVip, birthday, registrationTime) " +
            "VALUES(#{id}, #{name}, #{password}, #{phone}, #{sex}, #{isVip}, #{birthday}, #{registrationTime})")
    int insert(Order order);

    @Update("UPDATE user SET name = #{name}, phone = #{phone}, sex = #{sex}, birthday = #{birthday} WHERE id = #{id}")
    int update(Order order);

    @Delete("DELETE FROM user WHERE id = #{id}")
    int delete(Order order);
}
